package com.heu.blood.autologous.controller;

import java.util.Arrays;
import java.util.Map;


import com.heu.blood.common.aop.ControllerLogAnnotation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.heu.blood.autologous.entity.BloodOutStorgeAutologousEntity;
import com.heu.blood.autologous.service.BloodOutStorgeAutologousService;
import com.heu.blood.common.utils.PageUtils;
import com.heu.blood.common.utils.R;



/**
 * 
 *
 * @author lyj
 * @email lyj@heu.com
 * @date 2024-11-30 19:22:04
 */
@RestController
@RequestMapping("autologous/bloodoutstorgeautologous")
public class BloodOutStorgeAutologousController {
    @Autowired
    private BloodOutStorgeAutologousService bloodOutStorgeAutologousService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @ControllerLogAnnotation(module = "自体血模块", operate = "分页查询出库表信息")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = bloodOutStorgeAutologousService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @ControllerLogAnnotation(module = "自体血模块", operate = "根据id查询本条出库详细信息")
    public R info(@PathVariable("id") Long id){
		BloodOutStorgeAutologousEntity bloodOutStorgeAutologous = bloodOutStorgeAutologousService.getById(id);

        return R.ok().put("bloodOutStorgeAutologous", bloodOutStorgeAutologous);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @ControllerLogAnnotation(module = "自体血模块", operate = "保存出库表记录")
    public R save(@RequestBody BloodOutStorgeAutologousEntity bloodOutStorgeAutologous){
		bloodOutStorgeAutologousService.save(bloodOutStorgeAutologous);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @ControllerLogAnnotation(module = "自体血模块", operate = "修改出库表记录")
    public R update(@RequestBody BloodOutStorgeAutologousEntity bloodOutStorgeAutologous){
		bloodOutStorgeAutologousService.updateById(bloodOutStorgeAutologous);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @ControllerLogAnnotation(module = "自体血模块", operate = "批量逻辑删除出库表记录")
    public R delete(@RequestBody Long[] ids){
		bloodOutStorgeAutologousService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
